package com.aop.dynamic;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author xinwang
 * @date 2020/2/23 11:51
 **/
public class InvocationHandlerImpl implements InvocationHandler {

    private Object target;
    public InvocationHandlerImpl (Object target){
        this.target=target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Object result=null;
        System.out.println("动态代理 开始处理");
        result=method.invoke(target,args);
        System.out.println("动态代理 结束处理");
        return result;
    }
}
